# s='刘金玉{},{}创造城市'
# x=s.format('编程','编程')
# print(x)
s='刘金玉{a},{b}创造{c}'
x=s.format(a='编程',b='编程',c='城市')
print(x)
s='刘金玉{a},{1}创造{0}'#按照顺序格式化,关键字和数字一起用关键字要放最后
x=s.format('城市','编程',a='编程')
print(x)
###################################
list1=["编程","城市"]
s='刘金玉{list1[0]},{list1[0]}创造{list1[1]}'
x=s.format(list1=list1)
print(x)
list1=["编程","城市"]
s='刘金玉{a[0]},{a[0]}创造{a[1]}'
x=s.format(a=list1)
print(x)
##########
import math
s="PI={a.pi}"
x=s.format(a=math)
print(x)